function Test(peopleNum, groupNum) {
    let equal = parseInt(peopleNum / groupNum) //均值
    let surplus = peopleNum - equal * groupNum //剩下需要分配的
    let list = []
    let isErr = false
    for (let i = 0; i < groupNum; i++) {
        // 平均值
        list.push(equal)
        if (surplus > 0) {
            //分配剩余
            list[i] += 1
            surplus--
        }
        if (list[i] > 8) {
            list[i] = 8
            isErr = true
        }
    }
    console.log(list)
    return isErr
}

Test(25, 6)
Test(65, 9)
